package com.briup.estore.web.servlet;

import com.briup.estore.common.result.Result;
import com.briup.estore.common.utils.JsonUtils;
import com.briup.estore.service.OrderService;
import com.briup.estore.service.impl.OrderServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author briup-adam
 * @Date 2023/8/4 下午3:20
 * @Description 关闭订单  只能关闭未支付的订单
 **/
@WebServlet("/order/close")
public class OrderCloseServlet extends  BaseServlet {
    private OrderService orderService=new OrderServiceImpl();

    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String orderId = req.getParameter("id");
        orderService.closeOrder(orderId);
        writeData(resp, Result.success());

    }
}
